//   
//  TipAbstract
//  Model
//
//  Created by Suny on 15/4/2.
//  Copyright (c) 2015年 Sina. All rights reserved.
//

#import "TipAbstract.h"

@implementation TipAbstract

- (id)initWithDictionary:(NSDictionary *)dictionary
{
	self = [self init];
	if(self)
	{
            self.tipId = [dictionary objectForKey:TIPABSTRACT_TIPID_KEY];
             self.thumbnail = [dictionary objectForKey:TIPABSTRACT_THUMBNAIL_KEY];
             self.memberPhoto = [dictionary objectForKey:TIPABSTRACT_MEMBERPHOTO_KEY];
             self.title = [dictionary objectForKey:TIPABSTRACT_TITLE_KEY];
             self.flag = [dictionary objectForKey:TIPABSTRACT_FLAG_KEY];
             self.praiseNum = [dictionary objectForKey:TIPABSTRACT_PRAISENUM_KEY];
             self.memberId = [dictionary objectForKey:TIPABSTRACT_MEMBERID_KEY];
             self.collectNum = [dictionary objectForKey:TIPABSTRACT_COLLECTNUM_KEY];
             self.memberNickName = [dictionary objectForKey:TIPABSTRACT_MEMBERNICKNAME_KEY];
 
	}
	return self;
}

- (NSMutableDictionary *)dictionaryWithNameAndValue
{
    NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionary];

    [mutableDictionary setObject:self.tipId forKey:TIPABSTRACT_TIPID_KEY];
    [mutableDictionary setObject:self.thumbnail forKey:TIPABSTRACT_THUMBNAIL_KEY];
    [mutableDictionary setObject:self.memberPhoto forKey:TIPABSTRACT_MEMBERPHOTO_KEY];
    [mutableDictionary setObject:self.title forKey:TIPABSTRACT_TITLE_KEY];
    [mutableDictionary setObject:self.flag forKey:TIPABSTRACT_FLAG_KEY];
    [mutableDictionary setObject:self.praiseNum forKey:TIPABSTRACT_PRAISENUM_KEY];
    [mutableDictionary setObject:self.memberId forKey:TIPABSTRACT_MEMBERID_KEY];
    [mutableDictionary setObject:self.collectNum forKey:TIPABSTRACT_COLLECTNUM_KEY];
    [mutableDictionary setObject:self.memberNickName forKey:TIPABSTRACT_MEMBERNICKNAME_KEY];


    return mutableDictionary;
}




- (id)initWithCoder:(NSCoder *)coder
{
    self = [super init];
    if (self)
    {
            self.tipId = [coder decodeObjectForKey:TIPABSTRACT_TIPID_KEY];
            self.thumbnail = [coder decodeObjectForKey:TIPABSTRACT_THUMBNAIL_KEY];
            self.memberPhoto = [coder decodeObjectForKey:TIPABSTRACT_MEMBERPHOTO_KEY];
            self.title = [coder decodeObjectForKey:TIPABSTRACT_TITLE_KEY];
            self.flag = [coder decodeObjectForKey:TIPABSTRACT_FLAG_KEY];
            self.praiseNum = [coder decodeObjectForKey:TIPABSTRACT_PRAISENUM_KEY];
            self.memberId = [coder decodeObjectForKey:TIPABSTRACT_MEMBERID_KEY];
            self.collectNum = [coder decodeObjectForKey:TIPABSTRACT_COLLECTNUM_KEY];
            self.memberNickName = [coder decodeObjectForKey:TIPABSTRACT_MEMBERNICKNAME_KEY];

    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeObject:self.tipId forKey:TIPABSTRACT_TIPID_KEY];
    [coder encodeObject:self.thumbnail forKey:TIPABSTRACT_THUMBNAIL_KEY];
    [coder encodeObject:self.memberPhoto forKey:TIPABSTRACT_MEMBERPHOTO_KEY];
    [coder encodeObject:self.title forKey:TIPABSTRACT_TITLE_KEY];
    [coder encodeObject:self.flag forKey:TIPABSTRACT_FLAG_KEY];
    [coder encodeObject:self.praiseNum forKey:TIPABSTRACT_PRAISENUM_KEY];
    [coder encodeObject:self.memberId forKey:TIPABSTRACT_MEMBERID_KEY];
    [coder encodeObject:self.collectNum forKey:TIPABSTRACT_COLLECTNUM_KEY];
    [coder encodeObject:self.memberNickName forKey:TIPABSTRACT_MEMBERNICKNAME_KEY];

}



- (NSString *)description
{
    NSString *result = [NSString stringWithFormat:@"<%@: ", NSStringFromClass([self class])];
    result = [result stringByAppendingFormat:@"tipId : %@\n",self.tipId];
    result = [result stringByAppendingFormat:@"thumbnail : %@\n",self.thumbnail];
    result = [result stringByAppendingFormat:@"memberPhoto : %@\n",self.memberPhoto];
    result = [result stringByAppendingFormat:@"title : %@\n",self.title];
    result = [result stringByAppendingFormat:@"flag : %@\n",self.flag];
    result = [result stringByAppendingFormat:@"praiseNum : %@\n",self.praiseNum];
    result = [result stringByAppendingFormat:@"memberId : %@\n",self.memberId];
    result = [result stringByAppendingFormat:@"collectNum : %@\n",self.collectNum];
    result = [result stringByAppendingFormat:@"memberNickName : %@\n",self.memberNickName];

    result = [result stringByAppendingString:@">\n"];
    return result;
}






@end
